package com.wzh.chatgpt.data.domain.openai.service;

import cn.bugstack.chatglm.model.ChatCompletionRequest;
import com.wzh.chatgpt.data.domain.openai.model.aggregates.ChatProcessAggregate;
import com.wzh.chatgpt.data.domain.openai.model.entity.MessageEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;

import java.util.stream.Stream;

/**
 * @author: wzh
 * time 2023 12 13 22 13
 **/
@Service
public class ChatService extends AbstractChatService {

    @Override
    protected void doMessageResponse(ChatProcessAggregate chatProcess, ResponseBodyEmitter emitter) {
        Stream<MessageEntity> messages = chatProcess.getMessages().stream()
                .map(messageEntity -> MessageEntity.builder()
                        .role(messageEntity.getRole().toUpperCase())
                        .content(messageEntity.getContent())
                        .name(messageEntity.getName())
                        .build());
        ChatCompletionRequest request=new ChatCompletionRequest();
//        request.setModel(ChatGPTModel.GPT_3_5_TURBO);

    }
}
